Skip to content

fix(agc): do not use fragment barycentric on MoltenVK - #1653

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
morten-holm:pr/moltenvk-no-barycentric
Oct 10, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
morten-holm:pr/moltenvk-no-barycentric

Conversation

@morten-holm

Copy link
Copy Markdown
Contributor

What

MoltenVK reports VK_KHR_fragment_shader_barycentric, but its SPIR-V to MSL step rejects the PerVertexKHR decoration that the barycentric path of the translator uses ("SPIR-V to MSL conversion error: PerVertexKHR decoration is not supported in MSL"). Every pixel shader on that path then fails with VK_ERROR_INITIALIZATION_FAILED ("Fragment shader function could not be compiled into pipeline"), and the draw is skipped.

The feature is now treated as unavailable when the driver is MoltenVK (VK_KHR_driver_properties, VK_DRIVER_ID_MOLTENVK), so the existing no-barycentric path is used. The rule is FragmentShaderBarycentricUsable, a small header like SubgroupClock, so it has a unit test that needs no GPU.

Related: #1547 improves the no-barycentric path that MoltenVK now uses. On main today that path does not write the I/J VGPRs, so a shader that reads them for anything other than a plain v_interp_p1/p2 pair gets 0. Both PRs change VulkanDevice.cpp near the same lines; whichever lands second needs a small rebase.

Tested

  • macOS 27 (Apple M2), x86-64 under Rosetta, MoltenVK 1.4.2: one retail title, 30 s run. Before, 5 draws were skipped with the error above. After, none, and the picture is shown.
  • New test agc_fragment_barycentric (7 cases: MoltenVK reported or not, RADV, NVIDIA and AMD proprietary, Intel): passes, and the MoltenVK case fails when the rule is removed.
  • VulkanDevice.cpp compiles on this branch. main does not build libc on macOS yet, so I could not run the full suite here.
  • Not tested: Linux and Windows (CI), and other titles on MoltenVK that read the I/J registers beyond a plain interpolate (see feat(shader): emulate fragment barycentrics with a generated geometry stage #1547).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

MoltenVK reports VK_KHR_fragment_shader_barycentric, but its SPIR-V to MSL step
rejects the PerVertexKHR decoration that the barycentric path uses, so every
pixel shader on that path fails to compile into a pipeline. Treat the feature
as unavailable when the driver is MoltenVK, so the no-barycentric path is used.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@morten-holm morten-holm mentioned this pull request Oct 8, 2026
@github-actions github-actions Bot added build agc libSceAgc* labels Oct 8, 2026
utkuhalis added a commit to AnyTogether/AnyPS5-ARM that referenced this pull request Oct 9, 2026
… MoltenVK

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@popcoder565

Copy link
Copy Markdown
Contributor

Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 5333a205, merged onto main 8b393b6 in one build with 31 other PRs that had no Windows run.

  • The change targets MoltenVK, so on Windows this checks that agc_fragment_barycentric and the rest still pass.
  • Full ctest in that build: 520 of 521. The one failure is guest_offline_imports, broken by feat(libSceRudp): implement sceRudpGetStatus #2359 (reported there).

No title was run.

🤖 Addressed by Claude Code

oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2545 core/libs/prx/libSceAgcDriver/Execution/include/FragmentBarycentric.hpp
core/libs/prx/libSceAgcDriver/tests/FragmentBarycentric.cpp

@oneandonlydean
oneandonlydean merged commit 1d59f16 into boykopovar:main Oct 10, 2026
7 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…rycentric

fix(agc): do not use fragment barycentric on MoltenVK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants